package com.losdun.weixin.security.vo;

import com.losdun.weixin.domain.WechatUser;
import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.Collections;

/**
 * @Description
 * @Author Sword.Ye
 * @Date 2025/9/22
 **/
@Data
public class WxLoginUser implements UserDetails {

    private Long userId;

    private String openId;

    private String token;

    private Long loginTime;

    private Long expireTime;

    private WechatUser wechatUser;

    public WxLoginUser() {
    }

    public WxLoginUser(Long userId, String openId, WechatUser wechatUser) {
        this.userId = userId;
        this.openId = openId;
        this.wechatUser = wechatUser;
    }

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return Collections.emptyList();
    }

    @Override
    public String getPassword() {
        return null;
    }

    @Override
    public String getUsername() {
        return openId;
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }
}
